﻿using System;
using System.Web;
using System.Configuration;
namespace WinnerCMS.Common
{
    /// <summary>
    /// 异常处理类
    /// </summary>
    public class ErrClass
    {
        /// <summary>
        /// 跳转错误页面
        /// </summary>
        /// <param name="msg"></param>
        public static void Redirect(string msg)
        {
            try
            {
                HttpContext.Current.Response.Redirect("http://" + HttpContext.Current.Request.ServerVariables["http_host"] + ConfigurationManager.AppSettings["BackGroundPath"] + "Err.aspx?ErrMsg=" + msg.Replace("\n\r", "<br>"));
            }
            catch { }

        }
        /// <summary>
        /// 前台用的错误跳转
        /// </summary>
        /// <param name="msg"></param>
        public static void IndexErrRedirect(string msg)
        {
            try
            {
                HttpContext.Current.Response.Redirect("http://" + HttpContext.Current.Request.ServerVariables["http_host"] + "/Error.aspx?ErrMsg=" + msg.Replace("\n\r", "<br>"));
            }
            catch { }
        }
    }
}